﻿using System;

namespace Inaction.Database
{
    [Serializable]
    public class DbTypeInfo
    {
        #region 属性

        [System.ComponentModel.DisplayName("数据库数据类型")]
        public string DbType { get; set; }

        Type systemType;
        [System.ComponentModel.DisplayName(".Net数据类型")]
        [System.Xml.Serialization.XmlIgnore]
        public Type SystemType
        {
            get { return systemType; }
            set
            {
                systemType = value;
                typeName = value.FullName;
            }
        }

        string typeName = string.Empty;
        public string TypeName
        {
            get
            {
                return typeName;
            }
            set
            {
                typeName = value;
                systemType = Type.GetType(value);
            }
        }
        #endregion

        #region 构造
        public DbTypeInfo() { }

        public DbTypeInfo(string dbType, Type systemType)
        {
            DbType = dbType;
            SystemType = systemType;
        }
        #endregion
    }
}
